<template>
    <div class="good" style="margin-top: 30px;">
		<img :src="good.gsrc" />
		<h2>编号:{{good.gid}}</h2>
		<h3>{{good.gname}}</h3>
		<h3 style="color: #999;">商品详情:{{good.gtext}}</h3>
		<h3 style="color: red;">价格:￥{{good.gprice}}</h3>
		<button class="btn btn-primary" type="button">立即购买</button>
		&nbsp;&nbsp;
		<button class="btn btn-primary" type="button" @click="addShoppingCar">加入购物车</button>
	</div>
</template>
<script>
  export default {
    name: 'goodInf',
    data () {
      return {
        good: this.$route.params.good
      }
    },
	methods: {
		addShoppingCar(){
			this.$store.commit('addShoppingCar',this.good)
			this.$router.push('/')
			this.$message({
				message: '成功加入购物车!',
				type: 'success'
			})
		}
	}
  }
</script>
<style scoped>
	.good {
		
	}
	.good img {
		width: 300px;
		height: 300px;
	}
</style>
